﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace NpCrm.Domain
{
    public class Address : NpCrmEntityBase
    {
        [Key]
        [DatabaseGenerated(DatabaseGenerationOption.Identity)]
        public int AddressId { get; set; }

        [Required(ErrorMessage = "Please enter at least one address line")]
        [StringLength(255)]
        public string AddressLine1 { get; set; }

        [StringLength(255)]
        public string AddressLine2 { get; set; }

        [StringLength(255)]
        public string AddressLine3 { get; set; }

        [StringLength(255)]
        public string AddressLine4 { get; set; }

        [StringLength(255)]
        public string AddressLine5 { get; set; }

        [Required(ErrorMessage = "Please enter a city")]
        [StringLength(50)]
        public string City { get; set; }

        [StringLength(25)]
        public string StateProvince { get; set; }

        [Required(ErrorMessage = "Please enter a zip or postal code")]
        [StringLength(25)]
        public string PostalCode { get; set; }

        [StringLength(50)]
        public string Country { get; set; }

        [Required]
        public bool IsApartmentOrSuite { get; set; }

        [Required]
        public bool IsHomeAddress { get; set; }

        public virtual ICollection<Contact> Contacts { get; set; }

        public Address()
        {
            Contacts = new HashSet<Contact>();
        }
    }
}
